USB Dev Info

Mac OS USB

USB Versions and Functionality

  

This page presents information about the different releases of Mac OS USB and the associated Driver Development Kit (DDK). The information is targeted toward the Macintosh OS Development community. General Macintosh users may find this information interesting, however, to learn more about USB and other software updates for the iMac, refer to the Apple Tech Info Library article - "iMac: When to Install Available Updaters".

Mac OS USB v1.0

Mac OS USB v1.0 was built into the Mac OS ROM file, v1.1, which shipped with Mac OS v8.1 on original iMac. This release provided support for USB Hubs, and Human Input Devices (HID) which conform to the keyboard and mouse protocols. Drivers compiled with the Mac OS USB DDK 1.0, may still function with the later releases of USB, however, developers are advised to obtain more recent versions of the DDK and rebuild their products.

Mac OS USB v1.0.1

Mac OS USB v1.0.1 was built into the Mac OS ROM file, v1.1.2, file which shipped as part of the iMac Update v1.0. The iMac Update worked on iMacs with Mac OS v8.1 present. This version of USB was also part of the Mac OS v8.5 release. USB v1.0.1 improved the reliability of the USBBulkRead/Write calls most notably demonstrated in the improved reliability of USB printers.

API Additions from v1.0

  • USBGetConnectionIDByClass - call to obtain the CFrag ConnectionID using the device class, subclass and protocol.

Mac OS USB v1.1

Mac OS USB v1.1 was built into the Mac OS ROM file, v1.2.1, file which shipped as part of the Mac OS SSW v8.5.1 software update. For the Blue and White Power Macintosh G3, the Mac OS ROM file, v1.2, included this release of USB, as part of the default SSW v8.5.1 installation. USB v1.1 provided API's for USBIsocRead/Write calls. The Isochronous functionality was disabled for this release of USB.

This version of Mac OS USB was licensed to several vendors for inclusion with their USB PCI Adapter card product. In this case, Mac OS USB v1.1 may be found on systems using 8.5+

API changes from v1.0.1.

  • The USBDDriverNotifyProcPtr prototype. For USB v1.0.1, this call added the refCon parameter. Before using the refCon parameter, check the version of USB, and ensure that v1.1 or greater is installed.
  • In preparation for USB Isochronous support, the USB parameter block was converted into unions. Macros were provided to provide backwards compatibility.
  • USBIsocRead/Write calls are defined in the USB.h header file, and the calls are supported in the USBServicesLib stub library.

API Additions from v1.0.1

  • Introduces the USBSetConfiguration call as a replacement for the USBDeviceRequest/kUSBRqSetConfig call.
  • USBResetDevice - resets the specified device.
  • HostToUSBLong - converts the byte order for a four byte value from big-endian to little-endian.
  • USBToHostLong - converts the byte order for a four byte value from little-endian to big-endian.
  • USBDriverNotify - supports message passing between 2 drivers.
  • USBExpertNotifyParent - Allows a child driver to send a message to it's parent driver.
  • USBControlRequest - allows use of control endpoints (beside the default control pipe).

Mac OS USB v1.2

Mac OS USB v1.2 was built into the Mac OS ROM file, v1.4, which shipped as part of the Mac OS SSW v8.6 software update. This Mac OS ROM file supported both iMacs and Blue and White Power Macintosh G3s. This release has also been made available for installation to Power Macintosh 8.5+ systems which have PCI support but do not have USB built-in, using the USB Adapter Card Support Installer. USB v1.2 provided Isochronous support and support for multiple USB driver modules in one file. The individual driver modules of previous releases were merged into the USB Device Extension file.

API Changes from v1.1.

  • Removed the USBClosePipe call - Use the USBDisposeInterfaceRef to close the associated interface.

API Additions from v1.1

  • USBExpertStatusLevel - form of USBExpertStatus which allows developer to specify an associated status level with the message. A change in USBProber allows one to control the status level that will be displayed in the log window.
  • USBHIDInstallNotification - call to install a notification proc to be called when a HID device is attached.
  • USBIntWrite - queues and interrupt write transaction on a specified pipe.

Mac OS USB v1.2.1

Mac OS USB v1.2.1 was built into the Mac OS ROM file, v1.6, file which shipped as part of the Mac OS SSW v8.6 software release for the 99 PowerBook G3 Series and for the 33MHz iMac. This release was also built into the Mac OS ROM file, v1.7.1 for Mac OS SSW v8.6 for the Power Macintosh G4, 400MHz system with PCI Graphics. This release of USB is available as part of the Mac OS ROM Update v1.0. To access this update use the following URL.

http://asu.info.apple.com/swupdates.nsf/artnum/n11476

Mac OS USB v1.3.3

Mac OS USB v1.3.3 was built into the Mac OS ROM file, v2.3.1, which is a part of the iBook Mac OS SSW 8.6. This release of Mac OS USB is also built into the Mac OS SSW 8.6 for the Power Macintosh G4 systems with AGP Graphics and into the iMac 350/400MHz systems. Mac OS USB v1.3.3 incorporates the following class driver support for the following devices.

  • USBHIDDriver - support for HID class devices, subclass 0
  • USBHIDDriver1 - support for HID class devices, subclass 1
  • USBCommClassDriver - supports USB Comm Class devices, subclass "Abstract Control Model", protocol V.25.
  • USBAudioClassDriver - requires SSW 9.0
  • USBAudioStreamDriver - requires SSW 9.0
  • USBPrintingSupport
  • Vendor Specific immersion based force feedback joysticks
  • USBMassStorage
- Supported Mass Storage subclasses are:
subclass 1 - RBC (Reduced Block Commands) Compliant block storage devices
subclass 4 - UFI (USB Floppy Interface) compliant devices
subclass 5 - SFF-8070i ATAPI Removable Rewritable compliant devices
subclass 6 - SCSI Transparent command set devices.
- Support for USB Mass Storage protocols
protocol 0 - Command/Bulk/Interrupt protocol
protocol 1 - Command/Bulk protocol
protocol 80 - Bulk Only protocol
- Support for Standard HFS, Extended HFS and DOS volumes.
- Support for single and multiple partitioned disks
- Handling of auto and manual eject devices
- support UDF on compatible media (media with 2048 byte blocks such as 640MB Magneto-Optical cartridges).
 
Exceptions -
The USB Mass Storage components do not support
subclass 2 - SFF-8020i Compliant CD-ROM devices,
subclass 3 - QIC-157 compliant tape devices , and

Mac OS USB v1.3.3 provides support for the Software Locator, USB Suspend and Resume wakeup support. It also provides support for transaction and no-data timeouts, and for Cardbus USB cards on the PowerBook G3 Series systems with Mac OS 8.6 or greater present.

API Changes from v1.2.

  • Removed the USBOpenPipe call - Use the USBConfigureInterface function to set an active interface, and opens the pipes defined in the interface. Use the USBFindNextPipe call to identify the pipe references.

 API Additions from v1.2

  • Added the following new error results
kUSBDeviceSuspended             = -6974, /* Device is suspended */
kUSBDeviceNotSuspended      = -6973, /* device is not suspended for resume */
kUSBDeviceDisconnected        = -6972, /* Disconnected during suspend or reset */
kUSBTimedOut                            = -6971, /* Transaction timed out. */
kUSBNotHandled                        = -6987, /* Notification was not handled (same as NotFound)*/
  • Added the following usbFlag bit settings
kUSBReturnOnException      = 32,
kUSBTimeout                          = 128,
kUSBNoDataTimeout            = 256
  • Added the following USBDriverNotification defines
kNotifySystemSleepWakeUp      = 0x00000003,
kNotifySystemSleepRevoke         = 0x00000004,
  • Define kUSBMaxIsocFrameReqCount = 1023
  • Defined the following USB pipe states
            kUSBStalled               = 2, /* An error occured on the pipe*/
            kUSBSuspended      = 4 /* Device is suspended*
  • Modified the USBdeviceDescriptor to remove the last field "descEnd"
  • USBSuspendDevice - Suspends device, does not return until device is resumed.
  • USBResumeDeviceByReference - Forces resume of suspended device.
  • USBAbortQueuesByReference - Aborts queues (delay, memory allocation) associated with reference.
  • USBExpertGetStatusLevel - Gets the expert status level.
  • USBExpertSetStatusLevel - Sets the expert status level. (Like prober.)
  • USBGetVersion - returns the current USB version, the same result as would be obtained using Gestalt('usbv', ..)
  • USBAddShimFromDisk - allows extensions or installers to register a USB Shim with the USB Expert after the system has booted.
  • USBAddDriverForFSSpec - adds a driver for a device based on a device reference from the file specified in the FSSpec record.

Mac OS USB v1.3.5

Mac OS USB v1.3.5 was built into the Mac OS ROM file, v3.0 for Mac OS 9.0. This release addresses some last minute bugs which were identified with Mac OS USB 1.3.3. The Mac OS 9.0 Installer will automatically support any Power Macintosh systems that ship with USB built-in. For all other Power Macintosh systems where a USB PCI or Cardbus card must be used, a separate standalone installer is required to update Mac OS USB to 1.3.5. This Installer is available on the Apple Software Update web site.

Mac OS USB v1.4.1

Mac OS USB v1.4 was built into the Mac OS ROM file, x.x, for Mac OS 9.0.1. Mac OS USB v1.4 incorporates the following changes

  • USBPowerClassLib - support for USB power class devices to obtain status and control information of battery backups, UIninterruptible Power Supplies (UPS), and similar devices.

 API Additions from v1.2

  • Added the following new error results
kUSBPortDisabled               = -6969 /* Port is disabled, a reset is required */
kUSBQueueAborted             = -6970 /* Pipe zero stall cleared */
  • Added the following usbFlag bit settings
kUSBDebugAwareFlag      = 512,
  • USBSetPipePolicy - provides a method for modifying pipe parameters like the maxPacket size or isochronous bandwidth.
  • USBGetStringDescriptor - used to obtain the USB String Descriptor
  • USBPortStatus - used to query a hub to determine the port status of a port that a specific device, interface or pipe reference is connected to.
  • USBGetBandwidthAvailableByReference - used to obtain the available bandwidth for an isochronous device.
  • USBReferenceToRegEntry - returns the RegEntryID associated with a USBReference.

 

Which Driver Development Kit to use?

Use the latest released version of the Mac OS USB Driver Development Kit (DDK)for developing your USB software products. If you software is dependent on specific functionality or uses new API calls as listed above, then you want to

  • Verify the presence of the desired Mac OS USB release.
  • Weak-link to the USBManagerLib and to the USBServicesLib files. This will make it possible for CFM to load your code at which point the code becomes responsible for verifying the presence of the dependent calls (like USBIsocRead/Write).
  • Check the presence of the function vector for any USB function that is not implemented in all USB versions. Refer to Tech Note 1083 "Weak Linking to a CFM-based Shared Library", specifically the section on "Checking Library Imports", for information and a program example on how to do this. 

 

Checking for the correct version of USB

There are two places to check for the presence of the correct Mac OS USB version, if your driver or process is dependent on a minimum version being present. First check for the correct version in your Installer application. If the correct version is not present, you can raise an alert to the user to obtain the correct USB version. Second, you must check for the correct version within the process itself. There are two ways to check for the version of Mac OS USB is present.

  • Use the Gestalt call with the gestaltUSBVersion selector and all versions of Mac OS USB.
  • Under USB v1.3, there is the GetUSBVersion call.

Tranditionally, the Gestalt function has been used to check for the version of USB present. Doing this means that one must link the code to the InterfaceLib stub, which driver code should not have to do. For Mac OS USB v1.3, there is the GetUSBVersion call. The following code demonstrates how to use this call under all versions of USB without having to link to InterfaceLib. Note that MyUSBGetVersion only returns a version value if Mac OS USB v1.3 or greater is present. Remember to weak link to the USBServicesLib file, else the driver will fail to load.

#include <USB.h>  // ensure that you include the USB.h v1.3 header file
         
UInt32 MyUSBGetVersion(void)
{
    UInt32	version;
	
    if ((Ptr) USBGetVersion != (Ptr) kUnresolvedCFragSymbolAddress)
        version = USBGetVersion();
    else
	   version = 0;    // version of USB is less than 1.3
    return version;
}

To check whether isochronous support is present, you can use the MyUSBGetVersion function to check for the presence of USB v1.3, or you can also use Gestalt with the gestaltUSBAttr selector and check for the gestaltUSBHasIsoch bit being set in the response.